package com.zhiyou.service.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou.mapper.CommissionMapper;
import com.zhiyou.model.FyMyCommission;
import com.zhiyou.service.CommissionService;

@Service
public class CommissionServiceimp implements CommissionService {
	
	@Autowired
	CommissionMapper mapper;
	
	//添加待办
	public void add(FyMyCommission commission) {
		mapper.add(commission);
		
	}

	//删除
	public void delete(Integer commission_id) {
		System.out.println(commission_id);
		FyMyCommission byid = mapper.selectByid(commission_id);
		
		mapper.delete(commission_id);
		
	}
	//根据id查询
	public FyMyCommission selectByid(Integer commission_id) {
	/*System.out.println(commission_id);*/
		return mapper.selectByid(commission_id);
	}
	//查询全部
	public List<FyMyCommission> selectall() {
		
		return mapper.selectall();
	}

	public void update(FyMyCommission commission) {
		mapper.update(commission);
		
	}
	//标为全部以读
	public void readed() {
		List<FyMyCommission> list = mapper.selectall();
		
		for (FyMyCommission fyMyCommission : list) {
			if (fyMyCommission.getCommission_status()==0) {
				
				mapper.readed();
			}
		}	
			
		}
		
	}


